{% extends 'system_template/public/base_main.html' %}
{% block cite %}七牛云存储配置{% endblock %}
{% block head %}
    <style>
        .layui-input-block ul > li {
            float: left;
        }

        .layui-input-block ul > li > label {
            position: relative;
            left: -20px;
            top: 2px;
        }
    </style>
{% endblock %}
{% block content %}
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">{{ form.save_classification.label }}</label>
            <div class="layui-input-block">
                {{ form.save_classification }}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">{{ form.save_path.label }}</label>
            <div class="layui-input-inline">{{ form.save_path }}
                <div class="layui-form-mid">存储目录(使用默认,不推荐修改) 不以“/”结尾</div>
            </div>
        </div>
        <div style="display: {% if form.save_classification.data==1 %}none{% endif %}" class="save_class">
            {% for foo in form if foo.type!='RadioField' and foo.name!='save_path' %}
                <div class="layui-form-item">
                    <label class="layui-form-label">{{ foo.label }}</label>
                    <div class="layui-input-inline">
                        {{ foo }}
                        {% if foo.name=='access_key' or foo.name=='secret_key' %}
                            <i class="fa fa-eye-slash fa-lg conceal"></i>
                        {% endif %}
                        <div class="layui-form-mid">
                            {% if foo.name=='bucket_name' %}
                                七牛云存储空间名称 【TL-OSS存储 账号】
                            {% elif foo.name=='access_key' %}
                                七牛云 ACCESS_KEY (40位) / 七牛云密钥管理中 【TL-OSS公钥】
                            {% elif foo.name=='secret_key' %}
                                七牛云 SECRET_KEY (40位) / 七牛云密钥管理中【TL-OSS私钥】
                            {% elif foo.name=='bucket_domain' %}
                                七牛云【TL-OSS】绑定的域名 (访问资源) http:// 或 https:// 开头
                            {% endif %}
                        </div>
                    </div>
                </div>
            {% endfor %}
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <a class="layui-btn" onclick="submit_post()">保存配置</a>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
{% endblock %}
{% block footer %}
    <script>
        $(function () {
            $('#save_classification>li').on('click', function () {
                var save_class = $('.save_class');
                $('#save_classification>li>div').removeClass('layui-form-radioed');
                $('#save_classification>li>div>i').removeClass('layui-anim-scaleSpring').html('&#xe63f;');
                $(this).find('div').addClass('layui-form-radioed').find('i').html('&#xe643;');
                var stu = $(this).find('input').attr('value');
                if (stu !== '1') {
                    save_class.css('display', 'block')
                } else {
                    save_class.css('display', 'none')
                }
            })
        })
    </script>
{% endblock %}